import { registerAppMenu } from '@/app'
import { setInteraction } from '@/map-interaction'
import { registerAuxGraphicType } from '../core'
import { toLineString, type AuxArc, toFeature } from './core'
import { DrawAuxArc } from './draw-aux-arc'
import AuxArcInfoVue from './AuxArcInfo.vue'

export function setupAuxArc() {
  registerAuxGraphicType<AuxArc>({
    type: 'Arc',
    typeName: '辅助圆弧',
    geometry: (e) => [toLineString(e)],
    feature: toFeature,
    component: AuxArcInfoVue
  })
  registerAppMenu({
    path: '工具/地图Aux:绘制辅助圆弧',
    onClick() {
      setInteraction(new DrawAuxArc(true))
    }
  })
  registerAppMenu({
    path: '工具/地图Aux:绘制辅助圆弧[逆时针]',
    onClick() {
      setInteraction(new DrawAuxArc(false))
    }
  })
}
